﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;

namespace OracleDAL.AlarmManager
{
    public  class AlarmRestrict
    {
        public int updateAndAddRestrict(string sqlStr)
        {
            return DBUtility.OracleHelper.ExecuteSql(sqlStr);
        }
        public DataSet getRestrict(string whereStr)
        {
            string strSql = "select id,targetname,periodic,restrictvalue1,decode(alarmlevel1,'1','告警告警','2','主要告警','3','次要告警','4','紧急告警') as alarmlevel1 from alarmrestrict";
            strSql +=" where " + whereStr + "";
            return DBUtility.OracleHelper.Query(strSql);
        }
        public int deltRestrict(string id)
        {
            int result = 0;
            string strSql = "declare begin update pref_retrict_config  set ischoose='0' where prefname=(select targetname from alarmrestrict where id='"+id+"');delete alarmrestrict where id='" + id + "'; end;";
            try
            {
                result = DBUtility.OracleHelper.ExecuteSql(strSql);
            }
            catch (Exception e)
            { }
            return result;
        }
    }
}
